package lbj.cyw.dp;
/*
* Offer60. dicesProbability
*
* n个筛子的点数
*
* */
public class Offer60dicesProbability {
    public double[] dicesProbability(int n) {
        int[][] dp=new int[n+1][6*n+1];
        for(int i=1;i<=6;i++){
            dp[1][i]=1;
        }
        for(int i=2;i<=n;i++){
            for(int j=n;j<=6*j;j++){
                for(int k=1;k<=6&&k<=j;k++) {
                    dp[i][j]+=dp[i-1][j-k];
                }
            }
        }
        double[] res=new double[6*n-n+1];
        for(int i=n;i<=6*n;i++){
            res[i-n]=dp[n][i]*1.0/Math.pow(6,n);
        }
        return res;
    }
}
